var $$ = function(id){
    return document.getElementById(id);
}
var trim=function(str){
     return str.replace(/(^\s*)(\s*$)/g,'');
}

//搜索相关
var checkSearch = function(){
    var defaultTxt = '请输入关键字';
    var key = trim($$("keyword").value);
    if(key == '' || key == defaultTxt){
        $$("keyword").value =defaultTxt;
        return false;
    }
    return true;
}
$$("keyword").onclick = function(){
    this.select();
};

//改变导航选中状态
var naviStatus = function(){
    if(typeof classId != 'undefined' && classId>0 ){
        $("#main_menu_ul li").removeClass("current");
        $("#main_menu_ul li").each(function(){
            if($(this).attr("rel") == classId){
                $(this).addClass("current");
            }
        });
    }
}
naviStatus();

//PV统计
var pvCount = function(){
    if(pageType){
        if(pageType == 'document' && docId){
            document.write('<script type="text/javascript" src="http://pv.52zuomeng.com/pv.html?p=document&id='+ docId +'&app=1"></sc'+"ript>");
        }
        if(pageType == 'list'){
            //分享
            document.write('<script language="javascript" id="wofav_stat"></script><script src="http://share.wofav.com/share/wofav_r.js" _menu="1" _b="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|72|73|74|" _p="r" _img="no" _u="luobo525" id="oops"></sc'+"ript>");

        }
    }
}
pvCount();